﻿@model $prjsn$.Common.Models.Services.IArticleModel

@{
    // I. Pictures
    var pictures = new PlaceHolder();
    foreach (var file in Model.Attachments.Where(f => f.ContentType.IsImage))
    {
        pictures.AddControls(new DL
        {
            new DT
            {
                new Input(InputType.Text, "w400")
                    .SetValue("[IMG:"+ file.RelativePath +"]")
            },
            new DD("h100")
            {
                new Image(ResourceManager.CreateUrl(file.RelativePath),"h100")
                    .SetAlt(file.RelativePath)
            },
            new DD
            {
                new Anchor()
                    .SetHref(Url.Action("DeleteFile", new { id = Model.Item.ID, fileName = file.Name }))
                    .AddControls(new Literal("DeleteFile", true))
            }
        });
    }
    // II. Images
    var images = new PlaceHolder();
    foreach (var file in Model.Attachments.Where(f => f.ContentType.IsZip))
    {
        pictures.AddControls(new DL
        {
            new DT
            {
                new Input(InputType.Text, "w400")
                    .SetValue("[URL:" + file.RelativePath + "|TEXT:" + file.Name + "]")
            },
            new DD("h100")
            {
                new Image(ResourceManager.CreateUrl(file.RelativePath),"h100")
                    .SetAlt(file.RelativePath)
            },
            new DD
            {
                new Anchor()
                    .SetHref(Url.Action("DeleteFile", new { id = Model.Item.ID, fileName = file.Name }))
                    .AddControls(new Literal("DeleteFile", true))
            }
        });
    }
}
@AddControls(
    new Fieldset("w48p", "Pictures") { pictures },
    new Fieldset("w48p", "ZippedFiles") { images }
    )